package com.yaya.spring.mybatis;

import com.yaya.spring.mybatis.config.MybatisConfig;
import com.yaya.spring.mybatis.dao.UserMapper;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


/**
 * MybatisTest
 *
 * @author zhougf
 * @date 2019/9/24
 */
public class MybatisTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MybatisConfig.class);
        UserMapper userMapper = (UserMapper)applicationContext.getBean("xxx");
        System.out.println(userMapper.getUser());
//        SqlSessionFactory sqlSessionFactory = (SqlSessionFactory) applicationContext.getBean("sqlSessionFactory");
//        applicationContext.getBean("userMapper");
//        UserService userService = (UserService)applicationContext.getBean(UserService.class);
////        System.out.println(applicationContext.getBean(UserMapper.class));
////        System.out.println(userService.getUser());

//        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("mybatis.xml");
//        System.out.println(applicationContext.getBean(UserMapper.class));
//        SqlSession sqlSession = sqlSessionFactory.openSession();
//        UserMapper userMapper = (UserMapper) SqlSessionZyy.getMapper(UserMapper.class);
//        userMapper.getUser();


    }

}
